package core

// EmptyID 空ID

var EmptyID = ""

const (
	DefaultPassword string = "123456"
	AdminRoleCode   string = "super_admin"
)

// OutputMode 日志输出模式
type OutputMode string

const (
	// Console 命令行
	Console OutputMode = "console"
	// File 文件
	File OutputMode = "file"
	//All 命令行和文件
	All OutputMode = "all"
)

func (o OutputMode) GetValue() string {
	switch o {
	case Console:
		return "console"
	case File:
		return "file"
	case All:
		return "all"
	}
	return ""
}

// PermissionType 权限类型
type PermissionType int

const (
	Catalogue PermissionType = 1 //目录
	Menu      PermissionType = 2 //菜单
	Button    PermissionType = 3 //按钮
)

func (o PermissionType) GetValue() int {
	switch o {
	case Catalogue:
		return 1
	case Menu:
		return 2
	case Button:
		return 3
	}
	return 0
}

func GetPermissionType(i int) PermissionType {
	switch i {
	case 1:
		return Catalogue
	case 2:
		return Menu
	case 3:
		return Button
	}
	return 0
}

type Environment string

const (
	// Development 开发环境
	Development Environment = "development"
	// Production 生产环境
	Production Environment = "production"
)

func (e *Environment) GetValue() string {
	switch *e {
	case Development:
		return "development"
	case Production:
		return "production"
	}
	return ""
}

func GetEnvironment(s string) Environment {
	switch s {
	case "development":
		return Development
	case "production":
		return Production
	}
	return ""
}

type GenerateState int

const (
	// Generated 已生成 Generated
	Generated GenerateState = 1
	// NotGenerated 未生成 Not generated
	NotGenerated GenerateState = 2
	// ModifyNotGenerated 修改未生成 Modify not generated
	ModifyNotGenerated GenerateState = 3
)

// RelationType 关联关系类型
type RelationType int

const (
	// OneToOne 一对一
	OneToOne RelationType = 1
	// OneToMany 一对多
	OneToMany RelationType = 2
	// ManyToOne 多对一
	ManyToOne RelationType = 3
	// ManyToMany 多对多
	ManyToMany RelationType = 4
)

func (o RelationType) GetValue() int {
	switch o {
	case OneToOne:
		return 1
	case OneToMany:
		return 2
	case ManyToOne:
		return 3
	case ManyToMany:
		return 4
	}
	return 0
}
func GetRelationType(i int) RelationType {
	switch i {
	case 1:
		return OneToOne
	case 2:
		return OneToMany
	case 3:
		return ManyToOne
	case 4:
		return ManyToMany
	default:
		return 0
	}
}
